using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;

namespace MIPS
{
    public class Hilo
    {
        public Color miColor;
        public int IDHilo;
        public TextBox[] registros;
        public TextBox pcDecimal;
        public TextBox pcInstruccion;
        public String fileName;
        
        public Hilo(int IDHilo, String fileName){
            this.IDHilo=IDHilo;
            this.fileName = fileName;
        }
        public int getX(){
            return Int32.Parse(pcDecimal.Text)/32;
        }
        public int getY()
        {
            return Int32.Parse(pcDecimal.Text)%8;
        }
        public TextBox[] crearRegistros()
        {
            registros = new TextBox[32];
            int desplazamiento = 10;
            int altura = 0;
            for (int i = 0; i < 32; i++)
            {
                registros[i] = new TextBox();
                if (0==i && 10==desplazamiento)
                {
                    registros[i].Text ="0";//porque R0 siempre es 0
                    registros[i].ReadOnly = true;
                }
                registros[i].Text = "0";//
                registros[i].Width = 26;
                registros[i].Height = 20;

                if ((i % 10) == 0)
                {
                    altura = altura + 25;
                    desplazamiento = 10;
                }
                System.Drawing.Point punto = new System.Drawing.Point(desplazamiento, altura);
                registros[i].Location = punto;
                //this.tabControl.TabPages[0].Controls.Add(campos[i]);

                desplazamiento = desplazamiento + 38;
            }
            return registros;
        
        }
        public override String ToString() {
           // return "hilo: " + this.IDHilo +"(PC: "+this.pcDecimal+")";
            return "hilo: " + this.IDHilo +"      "+this.fileName+"";
        }
    }
}
